package com.nf.health.app.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.nf.health.app.R;
import com.nf.health.app.models.DoctorSerach;

import java.util.List;

public class SearchAdapter extends BaseAdapter {

	private List<DoctorSerach> doctors;
	public SearchAdapter(List<DoctorSerach> doctors) {
		this.doctors = doctors;
	}
	@Override
	public int getCount() {
		if(doctors != null){
			return doctors.size();
		}
		return 0;
	}

	@Override
	public Object getItem(int position) {
		return doctors.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder = ViewHolder.get(parent, convertView, R.layout.item_search_doctor, position);
		holder.setText(R.id.tv_doctor_name, doctors.get(position).getNick());
		holder.setText(R.id.tv_doctor_type, doctors.get(position).getHospitalname());
		return holder.getConvertView();
	}

}
